Skip to content

tgl: enable WOVCRO clock - #3418

Merged
lgirdwood merged 3 commits into
thesofproject:masterfrom
abonislawski:tgl_wovcro
Jan 15, 2021
Merged

lgirdwood merged 3 commits into
thesofproject:masterfrom
abonislawski:tgl_wovcro

Conversation

@abonislawski

@abonislawski abonislawski commented Sep 15, 2020 •

Copy link
Copy Markdown
Member

First patch will introduce CPU_WAITI_FREQ_IDX so a specific clock for WAITI can be configured per platform.
Second patch added releasing clock for waiti switches, it will fix #3448
Last patch will enable WOVCRO for TGL and allow to save significant amount of SOC power in low power S0ix WoV.

Patch is backward-compatible, if WOVCRO is not available (some old TGL steppings) then LPRO will be used for WAITI

@keyonjie

Copy link
Copy Markdown
Contributor

@abonislawski Thanks for enabling WOVCRO.

My concern is that switching to WOVCRO everywhere we intent to switch to LPRO looks too aggressive to me, can we force this for WoV on S0Ix only, and make the WFI context low power clock configurable? e.g. we already have USE_LPRO_IN_WAITI, maybe we can add a new item (e.g. USE_WOVCRO_IN_WAITI) under it and unselect it by default?

@lgirdwood lgirdwood added this to the v1.7 milestone Sep 18, 2020
@lgirdwood

Copy link
Copy Markdown
Member

SOFCI TEST

@abonislawski

Copy link
Copy Markdown
Member Author

@keyonjie its not everywhere, its in WAITI only.
low_power_mode is still switching to LPRO

but we can limit it to S0ix only if needed, any pros/cons?

Anyway WOVCRO needs to be enabled by default for our releases

Comment thread src/platform/intel/cavs/platform.c Resolved
@keyonjie

Copy link
Copy Markdown
Contributor

@keyonjie its not everywhere, its in WAITI only.
low_power_mode is still switching to LPRO

Oh, then it's bad, how can we switch to WOVCRO then? The "pm_runtime_put(CORE_HP_CLK, cpu_get_id())" is invoked after the HPRO->WOVCRO switching? won't it switch to LPRO for WoV on S0Ix?

	if (pm_is_active) {
		/* set HPRO clock if not already enabled */
		if (freq_idx != CPU_HPRO_FREQ_IDX)
			set_cpu_current_freq_idx(CPU_HPRO_FREQ_IDX, true);
	} else {
		/* set lowest waiti clock if not already enabled */
		if (freq_idx != CPU_WAITI_FREQ_IDX)
			set_cpu_current_freq_idx(CPU_WAITI_FREQ_IDX, true);
	}

	spin_unlock_irq(&prd->lock, flags);

	/* check if waiti clock switching is needed */
	pm_runtime_put(CORE_HP_CLK, cpu_get_id());

but we can limit it to S0ix only if needed, any pros/cons?

I am suggesting adding config items, to make it configurable. Please be noticed that the CONFIG_CAVS_USE_LPRO_IN_WAITI can be unslected so you might need to change the platform_clock_on_waiti() of the "#else" version also.

Anyway WOVCRO needs to be enabled by default for our releases

@abonislawski

Copy link
Copy Markdown
Member Author

Oh, then it's bad, how can we switch to WOVCRO then? The "pm_runtime_put(CORE_HP_CLK, cpu_get_id())" is invoked after the HPRO->WOVCRO switching? won't it switch to LPRO for WoV on S0Ix?

I need to investigate it because it looks like low_power_mode is a good place for WOVCRO switching. Power measurements gave great results so WOVCRO was working, need to check if this low_power_mode is working correctly then.

I am suggesting adding config items, to make it configurable. Please be noticed that the CONFIG_CAVS_USE_LPRO_IN_WAITI can be unslected so you might need to change the platform_clock_on_waiti() of the "#else" version also.

The CAVS approach is to use WOVCRO as lowest clock in WAITI stage because of power savings, so I think we should rename CONFIG_CAVS_USE_LPRO_IN_WAITI to something more universal for LPRO/WOVCRO and another layer for LPRO-or-WOVCRO switching is not necessary.

@zrombel

zrombel commented Sep 21, 2020 •

Copy link
Copy Markdown

This PR force us to upgrade our CI TGL RVP platforms to B0 stepping. At this point we are using A2 stepping platforms thus TGL smoke tests will FAIL. We plan to finish platform upgrade at the end of WW40.

@abonislawski

abonislawski commented Sep 23, 2020 •

Copy link
Copy Markdown
Member Author

Updated PR with clock switching moved to "low_power_mode".
The names are very confusing because the true clock switching for CONFIG_CAVS_USE_LPRO_IN_WAITI takes place in platform_clock_low_power_mode() instead of just platform_clock_on_waiti() as the name suggests.

Also added releasing clock for waiti switches, it will fix #3448
This issue is not introduced with WOVCRO but can be seen only with WOVCRO because of logic in platform_clock_on_waiti()

@abonislawski

Copy link
Copy Markdown
Member Author

@keyonjie good news for old steppings, added backward-compatible version (LPRO automatically selected) because it was reported to us that so many boards are still Ax :(

@lgirdwood

Copy link
Copy Markdown
Member

@abonislawski can you check CI could be a server issue ?

@abonislawski

Copy link
Copy Markdown
Member Author

@abonislawski can you check CI could be a server issue ?

I think CI issue

@keyonjie

keyonjie commented Sep 28, 2020 •

Copy link
Copy Markdown
Contributor

@abonislawski sorry, with this new WoVCRO clock introduced, the clock switching logic is becoming more complex and error-prone, we should be very careful when implement this, several items are not clear to me:

  1. the clock switching logic, e.g. we have 3 clocks (clock 0/1/2) in total, and all clock switching are performed at _waiti()/_wakeup(), basically:

_waiti(): possible High -> Low switching, scenarios including:

a. no switching needed. e.g. only 1 clock is supported/configured for the specific platform, or no any low power mode(e.g. LP for WAITI, or LP for D0I3) is configured. Another scenario like LPRO -> LPRO so no switching needed.
b. clock 2 (HPRO) -> clock 1 (LPRO). e.g. LP for waiti or LP for D0I3(but no clock 0 /WOVCRO existed) low power mode is selected.
c. clock 2 -> clock 0 (WoVCRO). LP for D0I3 low power mode is selected and WoVCRO existed. Need to make sure we only do a single switching, neither 'clock 2 -> clock 1 -> clock 0' nor 'clock 2 -> clock 0 -> clock 1' switching should happen.

_wakeup(): possible Low -> High switching, scenarios including:

a. clock 0 -> clock 1. xxx
b. clock 0 -> clock 2. yyy, neither 'clock 0 -> clock 1 -> clock 2' nor 'clock 0 -> clock 2 -> clock 1' switching should happen.
c. clock 1 -> clock 2. zzz
  1. make it clear about what is configurable and what isn't. e.g. LP low power for waiti (CONFIG_CAVS_USE_LPRO_IN_WAITI at the moment), LP low power mode for D0Ix (extra configure item needed? suppose we will always be required to switch to low power mode for D0Ix entry if possible, maybe no needed here), WOVCRO on D0Ix (a new configure item needed, at least for debugging purpose, it can be default 'Y', bug can be selected as 'N' to try only LPRO for D0Ix WoV).

So in short let's make this more clear in one shot, to avoid possible mysterious errors happen in the future.

Comment thread src/include/sof/lib/clk.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'm reading the comments about things becoming more complex so I think we can simplify by adding an inline comment to each "idx" and "notification" member in this struct. This should start to make things simpler for all reviewers to follow.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this index be a common parameter? Seems to be specific for cAVS platforms and left uninitialized/unused for others.

Comment thread src/platform/intel/cavs/lib/clk.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add another comment here explaining the new logic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was only about delay which isnt important for us, the remaining logic is pretty simple just as 'if' in code, if clock > LPRO then change to LPRO

Comment thread src/platform/intel/cavs/lib/clk.c Resolved
Comment thread src/platform/intel/cavs/lib/clk.c Resolved
Comment thread src/platform/intel/cavs/lib/clk.c Resolved
@keyonjie

keyonjie commented Nov 9, 2020

Copy link
Copy Markdown
Contributor

@abonislawski ping for update.

@abonislawski

Copy link
Copy Markdown
Member Author

PR updated and rebased.
@keyonjie no logic changes for clock switching, in short: LPRO replaced by WOVCRO (if WOVCRO available)

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've lost some context by removing a comment, we should really change the comment to match the new logic.

Comment thread src/platform/intel/cavs/lib/clk.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

Comment thread src/platform/tigerlake/lib/clk.c Resolved
@lgirdwood

Copy link
Copy Markdown
Member

Travis looks like a CI timeout unrelated to this PR.

@keyonjie

Copy link
Copy Markdown
Contributor

@abonislawski we should add a kconfig item to enable using this WOVCRO (e.g. disable it by default), then on most platforms where no WoV feature is needed, we use LPRO.

@abonislawski abonislawski changed the title tgl: enable WOVCRO clock [WIP] tgl: enable WOVCRO clock Nov 25, 2020
@abonislawski

Copy link
Copy Markdown
Member Author

Marked as WIP, will add and squash changes from tgl011 when done

@keyonjie

keyonjie commented Dec 3, 2020

Copy link
Copy Markdown
Contributor

@abonislawski time to proceed and get this merged to master now, feel free to squash changes I made on the 011 release branch.

@keyonjie

Copy link
Copy Markdown
Contributor

@abonislawski ping.

@lgirdwood

Copy link
Copy Markdown
Member

@abonislawski @keyonjie any updates - I assume the CI is OK ?

@abonislawski

abonislawski commented Jan 5, 2021 •

Copy link
Copy Markdown
Member Author

@lgirdwood I will update this as soon as tgl-011 issues are fixed

@lgirdwood

Copy link
Copy Markdown
Member

@abonislawski thanks - this is v1.7 blocker now. I will rerun CI to make sure everything looks good with recent updates.

@lgirdwood

Copy link
Copy Markdown
Member

SOFCI TEST

@abonislawski
abonislawski force-pushed the tgl_wovcro branch 2 times, most recently from e2752f8 to e6e13ad Compare January 11, 2021 14:11
@abonislawski abonislawski changed the title [WIP] tgl: enable WOVCRO clock tgl: enable WOVCRO clock Jan 11, 2021
@abonislawski

Copy link
Copy Markdown
Member Author

@lgirdwood PR updated

@lgirdwood lgirdwood left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'm not an expert on the WOVCRO. @keyonjie @mwasko @mmaka1 any comments ?
@abonislawski I assume this is same version used on production ?

@abonislawski

Copy link
Copy Markdown
Member Author

@lgirdwood yes, wovcro is already on tgl-010 and 011 releases, in 011 it was limited to s0ix only and this PR is updated with this change

@keyonjie

Copy link
Copy Markdown
Contributor

@abonislawski can you help to squash and add my commit dfdfa6b?
Better to make sure it is exactly same with tgl-011-drop-stable for this part, which has been verified work on TGL chrome.

@abonislawski

Copy link
Copy Markdown
Member Author

@keyonjie it is already done with limiting wovcro to s0ix, this is only a few lines of code so you can easily compare that it will work exactly the same.
Cannot use your commit without any changes because it is ignoring compatibility check in platform_clock_init().

@lgirdwood

Copy link
Copy Markdown
Member

@abonislawski @keyonjie let me know when good to merge.

@keyonjie keyonjie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abonislawski yes, functional exactly same with 011 base, can you change the naming 'waiti_freq_idx' to avoid confusion, others looks good to me.

Comment thread src/include/sof/lib/clk.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abonislawski better to change the naming to e.g. lowest_freq_idx to avoid confusion, as we actually use LPRO for the waiti context.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie updated with lowest_freq_idx

It will allow to define cpu lowest clock per platform
instead of fixed one (LPRO)

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
This patch will release previous clock in low power mode
because there are some rare problems with not releasing it

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
This will allow to save significant amount of SOC power
in low power S0ix WoV

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>

@keyonjie keyonjie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks.

@lgirdwood
lgirdwood merged commit fadd8e7 into thesofproject:master Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][TGL][KD]tgl-010-drop-stable: No KdDetectionNotification in D0ix for 16b/16b audio format

5 participants